#pragma once
#include <math.h>
#include <random>

class BDTestUtils
{
public:

	BDTestUtils();
	~BDTestUtils();

	static bool CalculateOverlap(int x1, int y1, int x2, int y2, int radius)
	{
		double distance = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
		if (distance > 2 * radius) {
			return 0;
		}
		if ((int)(acos(distance / (2 * radius)) * 100 / 1.57) == 0) {
			return false;
		}
		return true;
	}

	static void Random(BDVector<int>& images, int size)
	{
		images.clear();
		for (int i = 0; i < size; ++i) {
			images.push_back(i);
		}
		
		for (int i = 0; i < images.size(); ++i) {
			srand((int)time(0));
			int r = i + rand() % (images.size() - i);
			int temp = images[i];
			images[i] = images[r];
			images[r] = temp;
		}
	}

	static bool Intersects(int x1, int y1, int r1, int x2, int y2, int r2)
	{
		double distance = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
		return distance <= r1 + r2;
	}

	static bool Contains(int x1, int y1, int r1, int x2, int y2, int r2)
	{
		double distance = sqrt((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2));
		return distance <= abs(r1 - r2);
	}
};